<template>
    <div class="spider">
        <div class="search">
            <el-input
                v-model="input"
                class="w420 mr20"
                placeholder="请输入要检索的域名"
            ></el-input>
            <el-button @click="createSpider">检索</el-button>
        </div>
        <!-- <iframe
            width="800"
            height="500"
            frameborder="0"
            scrolling="auto"
            :src="url"
        ></iframe> -->
        <el-table :data="tableData" style="width: 100%">
            <el-table-column prop="id" label="ID" width="300" align="center">
            </el-table-column>
            <el-table-column prop="name" label="名称" align="center">
            </el-table-column>
            <el-table-column
                prop="updateTime"
                label="更新时间"
                width="300"
                align="center"
            >
            </el-table-column>
        </el-table>
    </div>
</template>

<script>
import { GetMovies, CreateSpider } from "../../api/index";
export default {
    name: "Table",
    components: {},
    data() {
        return {
            url: "https://www.dy2018.com/",
            input: "",
            tableData: [],
            page: {
                pagesize: 10,
                pagenum: 1,
            },
        };
    },
    created() {
        this.getList();
    },
    methods: {
        // 获取电影列表
        getList() {
            let params = this.page;
            GetMovies(params).then((res) => {
                console.log(res);
                this.tableData = res.data;
            });
        },
        // 爬虫指定网页
        createSpider() {
            let params = {
                url: this.url,
            };
            CreateSpider(params).then((res) => {
                console.log(res);
            });
        },
    },
};
</script>
<style lang="less" scoped>
@import url("../../assets/css/common.css");
.search {
    margin-bottom: 20px;
}
</style>
